

# 4. 打印1~100所有偶数的和 减去 所有奇数的和 的值
sum_qs = 0
sum_os = 0
for x in range(1,101):
    if x % 2 == 0:
        sum_os += x
    else:
        sum_qs += x
print(sum_os - sum_qs)

# 2） 使用while循环
i = 1
sum_qs = 0
sum_os = 0
while i <= 100:
    if i % 2 == 0:
        sum_os += i
    else:
        sum_qs += i
    i += 1
print(sum_os - sum_qs)

# 使用列表推导式 列表 = [表达式 循环体 表达式]
sum_os = sum([x for x in range(2,101,2)])
sum_js = sum([x for x in range(1,101,2)])
print(sum_os - sum_js)

# 5. 求1+2+3+...+100的和
sum1 = 0
for x in range(1,101):
    sum1 += x
print(sum1)

print(sum([x for x in range(1,101,1)]))

# 8. 输入三个整数x,y,z，请把这三个数由小到大输出。备注：输入方法：input()
x = int(input("请输入一个整数"))
y = int(input("请输入一个整数"))
z = int(input("请输入一个整数"))
lst = []
lst.append(x)
lst.append(y)
lst.append(z)
lst.sort()
print(lst)
